/** 
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package com.tompai.common.util;

import com.tompai.common.util.mail.MailSenderInfo;
import com.tompai.common.util.mail.SimpleMailSender;

/**
 * 发送邮件
 *
 * @author liinux@qq.com
 * @date 2019/10/22
 */
public class SendMail {

	public static boolean sendalert(String title, String content) {
		// 这个类主要是设置邮件
		MailSenderInfo mailInfo = new MailSenderInfo();
		mailInfo.setMailServerHost("smtp.163.com");
		mailInfo.setMailServerPort("25");
		mailInfo.setValidate(true);
		mailInfo.setUserName("lovsvol@163.com");
		mailInfo.setPassword("lovsvol123");// 您的邮箱密码
		mailInfo.setFromAddress("lovsvol@163.com");
		mailInfo.setToAddress("747319155@qq.com");
		mailInfo.setSubject(title);
		mailInfo.setContent(content);
		// 这个类主要来发送邮件
		SimpleMailSender sms = new SimpleMailSender();
		/* sms.sendTextMail(mailInfo);//发送文体格式 */
		if (sms.sendHtmlMail(mailInfo)) {// 发送html格式
			return true;
		} else {
			return false;
		}
	}
}
